<template>
  <div class="myContainer">
    <el-row class="myTitleBorderBottom myMarginBottom_10px">
      <el-col :span="12" class="myLineHeight_40px">
        {{title}}
      </el-col>
    </el-row>
    <el-row class="myPaddingBottom_10px">
      <el-col :span="3" class="myLeftMsg">
        <span class="require myVA_M">*</span>
         随机次数:
      </el-col>
      <el-col :span="7">
        <el-input placeholder="请输入随机次数" v-model="CONTENT"></el-input>
      </el-col>
    </el-row>
    <el-row class="myPaddingBottom_10px">
      <el-col :span="3" class="myLeftMsg myov">
        <span class="require myVA_M">*</span>
        连续签到几次获得红包:
      </el-col>
      <el-col :span="7">
        <el-input placeholder="请输入连续签到几次获得红包" v-model="D3"></el-input>
      </el-col>
    </el-row>
    <el-row class="myPaddingBottom_10px">
      <el-col :span="3" class="myLeftMsg">
        <span class="require myVA_M">*</span>
         最小金额(元):
      </el-col>
      <el-col :span="7">
        <el-input placeholder="请输入最小金额" v-model="D1"></el-input>
      </el-col>
    </el-row>
    <el-row class="myPaddingBottom_10px">
      <el-col :span="3" class="myLeftMsg">
        <span class="require myVA_M">*</span>
         最大金额(元):
      </el-col>
      <el-col :span="7">
        <el-input placeholder="请输入最大金额" v-model="D2"></el-input>
      </el-col>
    </el-row>
    
    <el-row class="myPaddingBottom_10px">
      <el-col :span="7" :offset="3">
        <el-button type="primary" class="myBgGreen" @click="onUpdateRedEnvelopes">保 存</el-button>
      </el-col>
    </el-row>
    
  </div>
</template>
<style scoped>
  .myContainer{
    background: #fff;
    padding: 10px;
  }
  .myTitleBorderBottom{
    color: #000;
    font-weight: 500;
    font-size: 16px;
    border-bottom: 1px solid #dbdbdb;
  }
  .myBgGreen{
    background: #00c2a9;
    border-color: #00c2a9;
    color: #fff;
    margin-top:2px;
  }
  .myBgGreen:hover{
    background: #33ceba;
  }
  .myTextAlignRight{
    text-align: right;
  }
  .myLineHeight_40px{
    line-height: 40px;
  }
  .myMarginTop_10px{
    margin-top: 10px;
  }
  .myLeftMsg{
    line-height: 40px;
    text-align: right;
    padding-right: 10px;
  }
  .myPaddingBottom_10px{
    padding-bottom: 10px;
  }
  .myVA_M{
    vertical-align: middle;
  }
  .myMarginBottom_10px{
    margin-bottom: 20px;
  }
  .myov{
    overflow-x:hidden;
    white-space: nowrap;
    text-overflow:ellipsis;
  }
</style>
<script>
  import { getRedEnvelopesDetail , updateRedEnvelopes } from '@/api/online';
  import qs from "querystring";
  export default {
    data(){
      return{
        title: "红包管理",
        CONTENT:"",
        D1:"",
        D2:"",
        D3:""
      }
    },
    components: {
        
    },
    created(){
      document.title=this.title;
      this.onGetRedEnvelopesDetail();
      
    },
    methods:{     
      onUpdateRedEnvelopes(){
        let vm=this;
        let params={
          INFORMATION_ID:5,
          CONTENT:vm.CONTENT,
          D1:vm.D1,
          D2:vm.D2,
          D3:vm.D3
        }
        updateRedEnvelopes(qs.stringify(params)).then(response => {
          let res=response.data;
          if(res.SUCCESS){
            vm.$message.success("执行成功！");
          }else{
            vm.$message.error("执行失败！");
          }
        }).catch(error => {
          vm.$message.error("执行失败！");
        }) 
      },
      onGetRedEnvelopesDetail(){
        let vm=this;
        let params={
          INFORMATION_ID:5
        }
        getRedEnvelopesDetail(params).then(response =>{
          let res=response.data.OBJECT;
          vm.CONTENT=res.CONTENT;
          vm.D1=res.D1;
          vm.D2=res.D2;
          vm.D3=res.D3;
        }).catch(error => {
        })
      }
    }
  
  }


</script>



